So far, we’ve run a bunch of analyses on the data split two different ways - by the WM capacity scores and by the high load DFR performance. Below is a table of the summary of analyses:
| Measure | WM | DFR |
|---|---|---|
DFR delay LE |
inverted U |
linearly increases |
constructs |
linearly increases |
linearly increases |
clinical |
linearly decreases |
linearly decreases |
cue period full mask |
asymptotic med,high > low in LE |
linearly increases for L3 and LE |
delay period full mask |
inverted U L3 and LE |
linearly increases L3 and LE |
delay period indiv ROIs |
inverted U in LE |
linearly increases in LE |
probe period full mask |
asymptotic med,high>low in LE |
linearly increases in LE |
FFA |
linearly increases in L cue LE |
linearly increases in L cue LE |
HPC Posterior |
inverted U @ L3 L cue, delay, probe |
no effect |
RSFC within network |
no effect |
FPCN: med > high VAN: low > high |
RSFC across network |
inverted U FPCN/CO |
no effects |
Beta Series connectivity cue |
no effect |
linearly increases L3: FPCN/FFA, FPCN/HPC, HPC/FFA LE: FPCN/FPCN, FPCN/FFA |
Beta Series connectivity delay |
LE: inverted U in HPC/FFA |
linearly decreases L3: FPCN/HPC |
BCT measures |
mean participation coefficient: U shaped DMN: U shaped VAN: linear increase |
no effect |
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(reshape2)
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(patchwork)
library(R.matlab)
## R.matlab v3.6.2 (2018-09-26) successfully loaded. See ?R.matlab for help.
##
## Attaching package: 'R.matlab'
## The following objects are masked from 'package:base':
##
## getOption, isOpen
load('data/load_effects_DFR.RData')
load('data/behav.RData')
load('data/structural_measures.RData')
load('data/connectivity_data.RData')
load('data/DFR_split_groups_info.RData')
load('data/split_WM_groups_fMRI.RData')
source('load_in_ROI.R')
source('split_TC_into_groups.R')
source('create_TC_for_plot.R')
# these times are based on when the actual cues were on the screen
rects <- data.frame(xstart=c(0,2.5,10),xend=c(2.5,10,12),col = factor(c("cue","delay","probe"),levels=c("cue","delay","probe")))
# adjust for hemodynamic delay
rects$xstart <- rects$xstart+5
rects$xend <- rects$xend+5
Interestingly, it looks like there is ovearchingly a linear relationship between these measures and DFR performance, with an inverted U-shape relationship with capacity. Let’s see if these relationships hold up when we include both of them in a model, especially for the ones where there is a significant relationship with both variables. For the WM capacity, we’re going to add in a quadratic term to see if that fits the data.
We’re also going to regress the effect of DFR accuracy out of omnibus span and see what the residuals look like plotted against our variables of interest.
base_data <- merge(p200_data,constructs_fMRI,by="PTID")
# want to create a base data that we can include in models - DFR accuracy, WM capacity and gender, age and WHODAS scores as covariates
base_data <- dplyr::select(base_data,PTID,"XDFR_MRI_ACC_L3","omnibus_span_no_DFR_MRI","X010701_GENDER","PX010101_AGE","WHO_ST_S32")
colnames(base_data) <- c("PTID","DFR_L3_ACC","omnibus_span", "gender", "age", "WHODAS")
base_data$span_sq <- base_data$omnibus_span^2
base_data <- merge(base_data,p200_demographics[,c(1,4)])
# shift to dummy coding
base_data$SCANNER <- base_data$SCANNER - 1
base_data$gender <- base_data$gender - 1
# one subject did not report gender - assign 0.5 as to not mess with the regression too much
base_data$gender[73] <- 0.5
# remove subjects with incomplete data
base_data <- base_data[c(1,90,92:105,107:170),]
For findings where DFR is significant, can try to regess it out of omnibus and plot that against variable of interest to see if inverted U shape is still present, since I’m not sure span^2 is the right measure.
omnibus.lm <- lm(omnibus_span ~ DFR_L3_ACC + gender + age + WHODAS + SCANNER, data= base_data)
summary(omnibus.lm)
##
## Call:
## lm(formula = omnibus_span ~ DFR_L3_ACC + gender + age + WHODAS +
## SCANNER, data = base_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.31306 -0.24803 0.02675 0.28368 0.79189
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.4546861 0.5106225 -0.890 0.3761
## DFR_L3_ACC 1.3803242 0.5653984 2.441 0.0170 *
## gender -0.1945473 0.1103004 -1.764 0.0819 .
## age -0.0109993 0.0104701 -1.051 0.2969
## WHODAS 0.0002215 0.0043189 0.051 0.9592
## SCANNER -0.0837151 0.1205155 -0.695 0.4895
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4569 on 74 degrees of freedom
## Multiple R-squared: 0.1074, Adjusted R-squared: 0.0471
## F-statistic: 1.781 on 5 and 74 DF, p-value: 0.1272
base_data$omnibus_resid <- resid(omnibus.lm)
full_mask_data <- merge(base_data,p200_DFR_full_mask)
cue_loadEffect_DFR.lm <- lm(cue_loadEffect ~ DFR_L3_ACC + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(cue_loadEffect_DFR.lm)
##
## Call:
## lm(formula = cue_loadEffect ~ DFR_L3_ACC + gender + age + WHODAS +
## SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.90531 -0.22948 -0.00748 0.17708 0.67657
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.4136513 0.3477157 -1.190 0.237997
## DFR_L3_ACC 1.3941795 0.3850162 3.621 0.000534 ***
## gender -0.0236037 0.0751106 -0.314 0.754213
## age -0.0070080 0.0071297 -0.983 0.328847
## WHODAS 0.0006013 0.0029410 0.204 0.838560
## SCANNER -0.1337834 0.0820667 -1.630 0.107313
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3112 on 74 degrees of freedom
## Multiple R-squared: 0.2007, Adjusted R-squared: 0.1467
## F-statistic: 3.716 on 5 and 74 DF, p-value: 0.004687
cue_loadEffect_span.lm <- lm(cue_loadEffect ~ omnibus_span + span_sq + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(cue_loadEffect_span.lm)
##
## Call:
## lm(formula = cue_loadEffect ~ omnibus_span + span_sq + gender +
## age + WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.92986 -0.20437 -0.00479 0.22024 0.66084
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.5153954 0.2322313 2.219 0.0296 *
## omnibus_span 0.1040112 0.0826575 1.258 0.2123
## span_sq 0.1044008 0.1226151 0.851 0.3973
## gender 0.0544244 0.0789557 0.689 0.4928
## age -0.0056419 0.0077184 -0.731 0.4671
## WHODAS 0.0001114 0.0031597 0.035 0.9720
## SCANNER -0.1364229 0.0884565 -1.542 0.1273
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3338 on 73 degrees of freedom
## Multiple R-squared: 0.09258, Adjusted R-squared: 0.018
## F-statistic: 1.241 on 6 and 73 DF, p-value: 0.2955
cue_loadEffect_all.lm <- lm(cue_loadEffect ~ omnibus_span + span_sq + DFR_L3_ACC + gender + age + WHODAS + SCANNER, data = full_mask_data)
summary(cue_loadEffect_all.lm)
##
## Call:
## lm(formula = cue_loadEffect ~ omnibus_span + span_sq + DFR_L3_ACC +
## gender + age + WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.89065 -0.22578 -0.01418 0.16702 0.66804
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.3799097 0.3547926 -1.071 0.28784
## omnibus_span 0.0388032 0.0804741 0.482 0.63114
## span_sq 0.0505711 0.1167131 0.433 0.66610
## DFR_L3_ACC 1.3098717 0.4086722 3.205 0.00201 **
## gender -0.0180476 0.0777342 -0.232 0.81706
## age -0.0067786 0.0072790 -0.931 0.35484
## WHODAS 0.0006976 0.0029819 0.234 0.81568
## SCANNER -0.1279304 0.0833645 -1.535 0.12927
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3144 on 72 degrees of freedom
## Multiple R-squared: 0.2059, Adjusted R-squared: 0.1287
## F-statistic: 2.667 on 7 and 72 DF, p-value: 0.01641
no_resid <- ggplot(data = full_mask_data, aes(x=omnibus_span,y=cue_loadEffect))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR not regressed")
resid <- ggplot(data = full_mask_data, aes(x=omnibus_resid,y=cue_loadEffect))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR regressed")
no_resid + resid+
plot_annotation(title = "Cue Load Effect")
cor.test(full_mask_data$omnibus_resid,full_mask_data$cue_loadEffect)
##
## Pearson's product-moment correlation
##
## data: full_mask_data$omnibus_resid and full_mask_data$cue_loadEffect
## t = 0.49495, df = 78, p-value = 0.622
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1658010 0.2723232
## sample estimates:
## cor
## 0.05595424
Interestingly, the delay period is the only finding that had an inverted U-shape relationship with capacity that held up when we regressed out the effects of accuracy.
delay_high_DFR.lm <- lm(delay_high ~ DFR_L3_ACC + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(delay_high_DFR.lm)
##
## Call:
## lm(formula = delay_high ~ DFR_L3_ACC + gender + age + WHODAS +
## SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.38378 -0.13449 -0.03422 0.09021 0.62031
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.546914 0.242262 -2.258 0.02692 *
## DFR_L3_ACC 0.737987 0.268250 2.751 0.00746 **
## gender 0.045753 0.052331 0.874 0.38478
## age 0.001946 0.004967 0.392 0.69632
## WHODAS 0.001044 0.002049 0.509 0.61194
## SCANNER -0.047811 0.057178 -0.836 0.40575
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2168 on 74 degrees of freedom
## Multiple R-squared: 0.144, Adjusted R-squared: 0.08618
## F-statistic: 2.49 on 5 and 74 DF, p-value: 0.03859
delay_high_span.lm <- lm(delay_high ~ omnibus_span + span_sq + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(delay_high_span.lm)
##
## Call:
## lm(formula = delay_high ~ omnibus_span + span_sq + gender + age +
## WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.40421 -0.14809 -0.03454 0.10732 0.59040
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.025694 0.159322 -0.161 0.872
## omnibus_span 0.015558 0.056707 0.274 0.785
## span_sq -0.017290 0.084120 -0.206 0.838
## gender 0.087375 0.054168 1.613 0.111
## age 0.002570 0.005295 0.485 0.629
## WHODAS 0.000586 0.002168 0.270 0.788
## SCANNER -0.057641 0.060686 -0.950 0.345
##
## Residual standard error: 0.229 on 73 degrees of freedom
## Multiple R-squared: 0.05779, Adjusted R-squared: -0.01965
## F-statistic: 0.7463 on 6 and 73 DF, p-value: 0.6143
delay_high_all.lm <- lm(delay_high ~ omnibus_span + span_sq + DFR_L3_ACC + gender + age + WHODAS + SCANNER, data = full_mask_data)
summary(delay_high_all.lm)
##
## Call:
## lm(formula = delay_high ~ omnibus_span + span_sq + DFR_L3_ACC +
## gender + age + WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.39929 -0.12964 -0.03817 0.08507 0.61096
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.573996 0.246907 -2.325 0.02291 *
## omnibus_span -0.024377 0.056003 -0.435 0.66467
## span_sq -0.050256 0.081223 -0.619 0.53804
## DFR_L3_ACC 0.802191 0.284403 2.821 0.00619 **
## gender 0.042991 0.054097 0.795 0.42939
## age 0.001874 0.005066 0.370 0.71246
## WHODAS 0.000945 0.002075 0.455 0.65019
## SCANNER -0.052440 0.058015 -0.904 0.36906
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2188 on 72 degrees of freedom
## Multiple R-squared: 0.1515, Adjusted R-squared: 0.06906
## F-statistic: 1.837 on 7 and 72 DF, p-value: 0.09314
no_resid <- ggplot(data = full_mask_data, aes(x=omnibus_span,y=delay_high))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR not regressed")
resid <- ggplot(data = full_mask_data, aes(x=omnibus_resid,y=delay_high))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR regressed")
no_resid + resid+
plot_annotation(title = "Delay High Load")
cor.test(full_mask_data$omnibus_resid,full_mask_data$delay_high)
##
## Pearson's product-moment correlation
##
## data: full_mask_data$omnibus_resid and full_mask_data$delay_high
## t = -0.48586, df = 78, p-value = 0.6284
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2713718 0.1667999
## sample estimates:
## cor
## -0.05493016
delay_loadEffect_DFR.lm <- lm(delay_loadEffect ~ DFR_L3_ACC + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(delay_loadEffect_DFR.lm)
##
## Call:
## lm(formula = delay_loadEffect ~ DFR_L3_ACC + gender + age + WHODAS +
## SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.59393 -0.11461 -0.02709 0.15460 0.63192
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.384499 0.249247 -1.543 0.12718
## DFR_L3_ACC 0.819120 0.275985 2.968 0.00404 **
## gender -0.070746 0.053840 -1.314 0.19290
## age -0.003607 0.005111 -0.706 0.48251
## WHODAS 0.004785 0.002108 2.270 0.02615 *
## SCANNER -0.027070 0.058827 -0.460 0.64675
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.223 on 74 degrees of freedom
## Multiple R-squared: 0.1759, Adjusted R-squared: 0.1202
## F-statistic: 3.158 on 5 and 74 DF, p-value: 0.01223
delay_loadEffect_span.lm <- lm(delay_loadEffect ~ omnibus_span + span_sq + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(delay_loadEffect_span.lm)
##
## Call:
## lm(formula = delay_loadEffect ~ omnibus_span + span_sq + gender +
## age + WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.59973 -0.14499 0.00264 0.14608 0.70624
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.182020 0.164718 1.105 0.2728
## omnibus_span 0.027008 0.058628 0.461 0.6464
## span_sq 0.039507 0.086969 0.454 0.6510
## gender -0.027530 0.056002 -0.492 0.6245
## age -0.003063 0.005475 -0.559 0.5776
## WHODAS 0.004424 0.002241 1.974 0.0522 .
## SCANNER -0.033450 0.062741 -0.533 0.5956
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2368 on 73 degrees of freedom
## Multiple R-squared: 0.08396, Adjusted R-squared: 0.008668
## F-statistic: 1.115 on 6 and 73 DF, p-value: 0.362
delay_loadEffect_all.lm <- lm(delay_loadEffect ~ omnibus_span + span_sq + DFR_L3_ACC + gender + age + WHODAS + SCANNER, data = full_mask_data)
summary(delay_loadEffect_all.lm)
##
## Call:
## lm(formula = delay_loadEffect ~ omnibus_span + span_sq + DFR_L3_ACC +
## gender + age + WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.58744 -0.12372 -0.02423 0.13848 0.63198
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.389508 0.255036 -1.527 0.13108
## omnibus_span -0.014618 0.057847 -0.253 0.80122
## span_sq 0.005144 0.083897 0.061 0.95128
## DFR_L3_ACC 0.836170 0.293767 2.846 0.00576 **
## gender -0.073793 0.055878 -1.321 0.19081
## age -0.003788 0.005232 -0.724 0.47142
## WHODAS 0.004798 0.002143 2.239 0.02827 *
## SCANNER -0.028028 0.059925 -0.468 0.64139
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.226 on 72 degrees of freedom
## Multiple R-squared: 0.1766, Adjusted R-squared: 0.09656
## F-statistic: 2.206 on 7 and 72 DF, p-value: 0.04351
no_resid <- ggplot(data = full_mask_data, aes(x=omnibus_span,y=delay_loadEffect))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR not regressed")
resid <- ggplot(data = full_mask_data, aes(x=omnibus_resid,y=delay_loadEffect))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR regressed")
no_resid + resid+
plot_annotation(title = "Delay Load Effect")
cor.test(full_mask_data$omnibus_resid,full_mask_data$delay_loadEffect)
##
## Pearson's product-moment correlation
##
## data: full_mask_data$omnibus_resid and full_mask_data$delay_loadEffect
## t = -0.23381, df = 78, p-value = 0.8157
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2447586 0.1943823
## sample estimates:
## cor
## -0.02646493
probe_loadEffect_DFR.lm <- lm(probe_loadEffect ~ DFR_L3_ACC + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(probe_loadEffect_DFR.lm)
##
## Call:
## lm(formula = probe_loadEffect ~ DFR_L3_ACC + gender + age + WHODAS +
## SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.88480 -0.45535 0.00185 0.46013 1.69318
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.4399094 0.7900589 -0.557 0.5793
## DFR_L3_ACC 1.7414872 0.8748107 1.991 0.0502 .
## gender -0.0485565 0.1706618 -0.285 0.7768
## age -0.0150524 0.0161998 -0.929 0.3558
## WHODAS 0.0008446 0.0066823 0.126 0.8998
## SCANNER 0.1276699 0.1864671 0.685 0.4957
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.707 on 74 degrees of freedom
## Multiple R-squared: 0.06473, Adjusted R-squared: 0.001533
## F-statistic: 1.024 on 5 and 74 DF, p-value: 0.4097
probe_loadEffect_span.lm <- lm(probe_loadEffect ~ omnibus_span + span_sq + gender + age + WHODAS + SCANNER, data= full_mask_data)
summary(probe_loadEffect_span.lm)
##
## Call:
## lm(formula = probe_loadEffect ~ omnibus_span + span_sq + gender +
## age + WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.8839 -0.4501 0.1026 0.4875 1.9026
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.045e-01 5.045e-01 1.396 0.167
## omnibus_span 1.872e-01 1.796e-01 1.043 0.301
## span_sq 6.769e-03 2.663e-01 0.025 0.980
## gender 6.472e-02 1.715e-01 0.377 0.707
## age -1.224e-02 1.677e-02 -0.730 0.468
## WHODAS -3.431e-05 6.864e-03 -0.005 0.996
## SCANNER 1.229e-01 1.921e-01 0.639 0.525
##
## Residual standard error: 0.7251 on 73 degrees of freedom
## Multiple R-squared: 0.02956, Adjusted R-squared: -0.05021
## F-statistic: 0.3705 on 6 and 73 DF, p-value: 0.8954
probe_loadEffect_all.lm <- lm(probe_loadEffect ~ omnibus_span + span_sq + DFR_L3_ACC + gender + age + WHODAS + SCANNER, data = full_mask_data)
summary(probe_loadEffect_all.lm)
##
## Call:
## lm(formula = probe_loadEffect ~ omnibus_span + span_sq + DFR_L3_ACC +
## gender + age + WHODAS + SCANNER, data = full_mask_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.92924 -0.43279 0.01915 0.44137 1.71501
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.410914 0.806746 -0.509 0.6121
## omnibus_span 0.105981 0.182986 0.579 0.5643
## span_sq -0.060293 0.265388 -0.227 0.8209
## DFR_L3_ACC 1.631856 0.929260 1.756 0.0833 .
## gender -0.025562 0.176756 -0.145 0.8854
## age -0.013651 0.016552 -0.825 0.4122
## WHODAS 0.000696 0.006780 0.103 0.9185
## SCANNER 0.133437 0.189558 0.704 0.4837
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.715 on 72 degrees of freedom
## Multiple R-squared: 0.06941, Adjusted R-squared: -0.02106
## F-statistic: 0.7672 on 7 and 72 DF, p-value: 0.6165
no_resid <- ggplot(data = full_mask_data, aes(x=omnibus_span,y=probe_loadEffect))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR not regressed")
resid <- ggplot(data = full_mask_data, aes(x=omnibus_resid,y=probe_loadEffect))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR regressed")
no_resid + resid+
plot_annotation(title = "Probe Load Effect")
cor.test(full_mask_data$omnibus_resid,full_mask_data$probe_loadEffect)
##
## Pearson's product-moment correlation
##
## data: full_mask_data$omnibus_resid and full_mask_data$probe_loadEffect
## t = 0.56106, df = 78, p-value = 0.5764
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1585256 0.2792269
## sample estimates:
## cor
## 0.06339958
Looking at the load effect in the L FFA during the cue period.
FFA_data <- merge(base_data,p200_FFA)
FFA_loadEffect_DFR.lm <- lm(L_CUE_LE ~ DFR_L3_ACC + gender + age + WHODAS + SCANNER, data= FFA_data)
summary(FFA_loadEffect_DFR.lm)
##
## Call:
## lm(formula = L_CUE_LE ~ DFR_L3_ACC + gender + age + WHODAS +
## SCANNER, data = FFA_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.07509 -0.30925 -0.06537 0.30747 1.65380
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.911835 0.551217 -1.654 0.10232
## DFR_L3_ACC 1.972335 0.610347 3.231 0.00184 **
## gender 0.184215 0.119069 1.547 0.12610
## age 0.001152 0.011302 0.102 0.91911
## WHODAS -0.001668 0.004662 -0.358 0.72150
## SCANNER -0.123518 0.130096 -0.949 0.34549
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4933 on 74 degrees of freedom
## Multiple R-squared: 0.1969, Adjusted R-squared: 0.1426
## F-statistic: 3.628 on 5 and 74 DF, p-value: 0.00545
FFA_loadEffect_span.lm <- lm(L_CUE_LE ~ omnibus_span + gender + age + WHODAS + SCANNER, data= FFA_data)
summary(FFA_loadEffect_span.lm)
##
## Call:
## lm(formula = L_CUE_LE ~ omnibus_span + gender + age + WHODAS +
## SCANNER, data = FFA_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.01990 -0.34760 -0.04012 0.36158 1.56780
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.350032 0.354705 0.987 0.32694
## omnibus_span 0.278021 0.124843 2.227 0.02899 *
## gender 0.321146 0.119636 2.684 0.00896 **
## age 0.005052 0.011754 0.430 0.66856
## WHODAS -0.002644 0.004808 -0.550 0.58399
## SCANNER -0.122622 0.134860 -0.909 0.36617
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5101 on 74 degrees of freedom
## Multiple R-squared: 0.1411, Adjusted R-squared: 0.08307
## F-statistic: 2.431 on 5 and 74 DF, p-value: 0.04266
FFA_loadEffect_all.lm <- lm(L_CUE_LE ~ omnibus_span + DFR_L3_ACC + gender + age + WHODAS + SCANNER, data = FFA_data)
summary(FFA_loadEffect_all.lm)
##
## Call:
## lm(formula = L_CUE_LE ~ omnibus_span + DFR_L3_ACC + gender +
## age + WHODAS + SCANNER, data = FFA_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.06117 -0.32496 -0.04474 0.33359 1.58712
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.827569 0.549661 -1.506 0.13648
## omnibus_span 0.185328 0.124470 1.489 0.14081
## DFR_L3_ACC 1.716522 0.629297 2.728 0.00798 **
## gender 0.220271 0.120559 1.827 0.07178 .
## age 0.003190 0.011294 0.282 0.77838
## WHODAS -0.001709 0.004624 -0.370 0.71274
## SCANNER -0.108003 0.129460 -0.834 0.40686
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4893 on 73 degrees of freedom
## Multiple R-squared: 0.2205, Adjusted R-squared: 0.1565
## F-statistic: 3.443 on 6 and 73 DF, p-value: 0.004754
no_resid <- ggplot(data = FFA_data, aes(x=omnibus_span,y=L_CUE_LE))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR not regressed")
resid <- ggplot(data = FFA_data, aes(x=omnibus_resid,y=L_CUE_LE))+
geom_point()+
stat_smooth(method="loess")+
ggtitle("DFR regressed")
no_resid + resid+
plot_annotation(title = "L FFA - cue LE")
cor.test(FFA_data$omnibus_resid,FFA_data$L_CUE_LE)
##
## Pearson's product-moment correlation
##
## data: FFA_data$omnibus_resid and FFA_data$L_CUE_LE
## t = 1.3752, df = 78, p-value = 0.173
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.06816677 0.36135593
## sample estimates:
## cor
## 0.1538545
HL <- split_constructs[["low"]][split_constructs[["low"]]$PTID %in% DFR_median_split_groups[["high"]]$PTID,]
HL$level <- "HL"
HM <- split_constructs[["med"]][split_constructs[["med"]]$PTID %in% DFR_median_split_groups[["high"]]$PTID,]
HM$level <- "HM"
HH <- split_constructs[["high"]][split_constructs[["high"]]$PTID %in% DFR_median_split_groups[["high"]]$PTID,]
HH$level <- "HH"
LL <- split_constructs[["low"]][split_constructs[["low"]]$PTID %in% DFR_median_split_groups[["low"]]$PTID,]
LL$level <- "LL"
LM <- split_constructs[["med"]][split_constructs[["med"]]$PTID %in% DFR_median_split_groups[["low"]]$PTID,]
LM$level <- "LM"
LH <- split_constructs[["high"]][split_constructs[["high"]]$PTID %in% DFR_median_split_groups[["low"]]$PTID,]
LH$level <- "LH"
things_to_hist <- rbind(HL,HM,HH,LL,LM,LH)
six_groups <- list(HL = data.frame(HL), HM = data.frame(HM), HH = data.frame(HH), LL = data.frame(LL), LM = data.frame(LM), LH = data.frame(LH), all = data.frame(things_to_hist))
basepath <- "~/Documents/UCLA/Research/RDoC/TimeCourseData/"
# delay period
delay_ROI_list <- c("L_dlPFC", "L_aMFG", "L_dMFG", "L_IPS", "L_preSMA", "R_dlPFC", "R_dMFG",
"R_IPS", "R_medParietal")
delay_TCs <- load_in_ROI(basepath, delay_ROI_list)
# cue
cue_ROI_list <- c("cue_R_preSMA", "cue_R_occipital", "cue_R_MFG", "cue_R_IPS", "cue_R_insula",
"cue_R_FEF", "cue_L_occipital", "cue_L_IPS", "cue_L_insula", "cue_L_FEF")
cue_TCs <- load_in_ROI(basepath, cue_ROI_list)
# probe
probe_ROI_list <- c("probe_R_OFC", "probe_R_insula", "probe_R_dlPFC", "probe_L_IPS", "probe_L_insula",
"probe_L_dlPFC", "probe_L_aMFG", "probe_dmPFC")
probe_TCs <- load_in_ROI(basepath, probe_ROI_list)
allSubjs <- constructs_fMRI$PTID
split_cue_six_groups <- split_TC_into_groups(cue_TCs,six_groups,allSubjs,group_names=c("HL","HM","HH", "LL", "LM", "LH"))
split_delay_six_groups <- split_TC_into_groups(delay_TCs,six_groups,allSubjs,group_names=c("HL","HM","HH", "LL", "LM", "LH"))
split_probe_six_groups <- split_TC_into_groups(probe_TCs,six_groups,allSubjs,group_names=c("HL","HM","HH", "LL", "LM", "LH"))
cue_TC_for_plot <- create_TC_for_plot(split_cue_six_groups)
delay_TC_for_plot <- create_TC_for_plot(split_delay_six_groups)
probe_TC_for_plot <- create_TC_for_plot(split_probe_six_groups)
Here, we’re plotting our data split into 6 groups - based on both WM capacity and a median split DFR performance.
Groups are labeled by this split - the first letter (H/L) is the DFR split and the second letter (H/M/L) is the WM split.
for (ROI in seq.int(1,length(cue_TC_for_plot))){
print(ggplot(data=cue_TC_for_plot[[ROI]][["wide"]]) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf, fill=col), alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=L3,color=level),size=1)+
geom_line(aes(x=Time,y=L1,color=level),size=1,linetype="dashed")+
ylab("Mean Activity") +
ggtitle(paste0("L3 vs L1 - ",names(cue_TC_for_plot)[ROI]))+
ylim(c(-.4,.6)))
}
for (ROI in seq.int(1,length(delay_TC_for_plot))){
print(ggplot(data=delay_TC_for_plot[[ROI]][["wide"]]) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf, fill=col), alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=L3,color=level),size=1)+
geom_line(aes(x=Time,y=L1,color=level),size=1,linetype="dashed")+
ylab("Mean Activity") +
ggtitle(paste0("L3 vs L1 - ",names(delay_TC_for_plot)[ROI]))+
ylim(c(-.4,.6)))
}
for (ROI in seq.int(1,length(probe_TC_for_plot))){
print(ggplot(data=probe_TC_for_plot[[ROI]][["wide"]]) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf, fill=col), alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=L3,color=level),size=1)+
geom_line(aes(x=Time,y=L1,color=level),size=1,linetype="dashed")+
ylab("Mean Activity") +
ggtitle(paste0("L3 vs L1 - ",names(probe_TC_for_plot)[ROI]))+
ylim(c(-.4,.6)))
}
for (ROI in seq.int(1,length(cue_TC_for_plot))){
print(ggplot(data=cue_TC_for_plot[[ROI]][["wide"]]) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load == "LE"),aes(x=Time,ymin=SE_min,ymax=SE_max,fill=level),alpha=.2,linetype=2)+
ylab("Mean Activity") +
ggtitle(paste0("LE - ",names(cue_TC_for_plot)[ROI]))+
ylim(c(-.4,.6))
)
}
for (ROI in seq.int(1,length(delay_TC_for_plot))){
print(ggplot(data=delay_TC_for_plot[[ROI]][["wide"]]) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load == "LE"),aes(x=Time,ymin=SE_min,ymax=SE_max,fill=level),alpha=.2,linetype=2)+
ylab("Mean Activity") +
ggtitle(paste0("LE - ",names(delay_TC_for_plot)[ROI]))+
ylim(c(-.4,.6))
)
}
for (ROI in seq.int(1,length(probe_TC_for_plot))){
print(ggplot(data=probe_TC_for_plot[[ROI]][["wide"]]) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load == "LE"),aes(x=Time,ymin=SE_min,ymax=SE_max,fill=level),alpha=.2,linetype=2)+
ylab("Mean Activity") +
ggtitle(paste0("LE - ",names(probe_TC_for_plot)[ROI]))+
ylim(c(-.4,.6))
)
}
To be able to compare across groups better, let’s split high performing and low performing groups onto different graphs.
low_col = c("turquoise","blue","violet")
high_col = c("red","gold","green")
for (ROI in seq.int(1,length(cue_TC_for_plot))){
low <- ggplot(data=cue_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LL" | level == "LM" | level == "LH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="turquoise")+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="blue")+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="violet")+
ylab("Mean Activity") +
ggtitle("Low Performing Subjects")+
ylim(c(-.2,.4))+
scale_colour_manual(values=low_col)
high <- ggplot(data=cue_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "HL" | level == "HM" | level == "HH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HL"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="red",alpha=.2,linetype=2)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HM"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="gold",alpha=.2,linetype=2)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HH"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="green",alpha=.2,linetype=2)+
ylab("Mean Activity") +
ggtitle("High Performing Subjects")+
ylim(c(-.2,.4))+
scale_colour_manual(values=high_col)
print((low + high) +
plot_annotation(title= names(cue_TC_for_plot)[[ROI]])+
plot_layout(guides = "collect"))
}
low_col = c("turquoise","blue","violet")
high_col = c("red","gold","green")
for (ROI in seq.int(1,length(delay_TC_for_plot))){
low <- ggplot(data=delay_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LL" | level == "LM" | level == "LH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="turquoise")+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="blue")+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="violet")+
ylab("Mean Activity") +
ggtitle("Low Performing Subjects")+
ylim(c(-.2,.4))+
scale_colour_manual(values=low_col)
high <- ggplot(data=delay_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "HL" | level == "HM" | level == "HH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HL"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="red",alpha=.2,linetype=2)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HM"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="gold",alpha=.2,linetype=2)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HH"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="green",alpha=.2,linetype=2)+
ylab("Mean Activity") +
ggtitle("High Performing Subjects")+
ylim(c(-.2,.4))+
scale_colour_manual(values=high_col)
print((low + high) +
plot_annotation(title= names(delay_TC_for_plot)[[ROI]])+
plot_layout(guides = "collect"))
}
low_col = c("turquoise","blue","violet")
high_col = c("red","gold","green")
for (ROI in seq.int(1,length(probe_TC_for_plot))){
low <- ggplot(data=probe_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LL" | level == "LM" | level == "LH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="turquoise")+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="blue")+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="violet")+
ylab("Mean Activity") +
ggtitle("Low Performing Subjects")+
ylim(c(-.2,.4))+
scale_colour_manual(values=low_col)
high <- ggplot(data=probe_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "HL" | level == "HM" | level == "HH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HL"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="red",alpha=.2,linetype=2)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HM"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="gold",alpha=.2,linetype=2)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HH"),aes(x=Time,ymin=SE_min,ymax=SE_max),fill="green",alpha=.2,linetype=2)+
ylab("Mean Activity") +
ggtitle("High Performing Subjects")+
ylim(c(-.2,.4))+
scale_colour_manual(values=high_col)
print((low + high) +
plot_annotation(title= names(probe_TC_for_plot)[[ROI]])+
plot_layout(guides = "collect"))
}
Same idea, but split on WMC.
low_col <- c("red","turquoise")
med_col <- c("gold","blue")
high_col <- c("green","violet")
for (ROI in seq.int(1,length(cue_TC_for_plot))){
low <- ggplot(data=cue_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LL" | level == "HL")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="turquoise")+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="red")+
ylab("Mean Activity") +
ggtitle("Low WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=low_col)
med <- ggplot(data=cue_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LM" | level == "HM")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="blue")+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="gold")+
ylab("Mean Activity") +
ggtitle("Med WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=med_col)
high <- ggplot(data=cue_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LH" | level == "HH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="violet")+
geom_ribbon(data=cue_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="green")+
ylab("Mean Activity") +
ggtitle("High WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=high_col)
print((low + med + high) +
plot_annotation(title= names(cue_TC_for_plot)[[ROI]])+
plot_layout(guides = "collect")
)
}
low_col <- c("red","turquoise")
med_col <- c("gold","blue")
high_col <- c("green","violet")
for (ROI in seq.int(1,length(delay_TC_for_plot))){
low <- ggplot(data=delay_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LL" | level == "HL")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="turquoise")+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="red")+
ylab("Mean Activity") +
ggtitle("Low WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=low_col)
med <- ggplot(data=delay_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LM" | level == "HM")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="blue")+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="gold")+
ylab("Mean Activity") +
ggtitle("Med WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=med_col)
high <- ggplot(data=delay_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LH" | level == "HH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="violet")+
geom_ribbon(data=delay_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="green")+
ylab("Mean Activity") +
ggtitle("High WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=high_col)
print((low + med + high) +
plot_annotation(title= names(delay_TC_for_plot)[[ROI]])+
plot_layout(guides = "collect"))
}
low_col <- c("red","turquoise")
med_col <- c("gold","blue")
high_col <- c("green","violet")
for (ROI in seq.int(1,length(probe_TC_for_plot))){
low <- ggplot(data=probe_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LL" | level == "HL")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="turquoise")+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HL"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="red")+
ylab("Mean Activity") +
ggtitle("Low WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=low_col)
med <- ggplot(data=probe_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LM" | level == "HM")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="blue")+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HM"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="gold")+
ylab("Mean Activity") +
ggtitle("Med WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=med_col)
high <- ggplot(data=probe_TC_for_plot[[ROI]][["wide"]] %>% filter(level == "LH" | level == "HH")) +
geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
geom_line(aes(x=Time,y=LE,color=level),size=1)+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "LH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="violet")+
geom_ribbon(data=probe_TC_for_plot[[ROI]][["long"]] %>% filter(load=="LE") %>% filter(level == "HH"),aes(x=Time,ymin=SE_min,ymax=SE_max),alpha=.2,linetype=2,fill="green")+
ylab("Mean Activity") +
ggtitle("High WMC")+
ylim(c(-.2,.4))+
scale_colour_manual(values=high_col)
print((low + med + high) +
plot_annotation(title= names(probe_TC_for_plot)[[ROI]])+
plot_layout(guides = "collect"))
}